package com.qf.index;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ConcurrentHashSet;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ZipUtil;
import cn.hutool.db.Db;
import cn.hutool.db.Entity;
import cn.hutool.json.JSON;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject;

import java.io.IOException;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;

public class WebSite {
    public static void main(String[] args) throws SQLException, IOException {

        String newDataName = "scholar_25_02.";
        String doiTable = newDataName + "doi_location_20230112";
        String doiAddTable = newDataName + "doi_location_20230112_add";
        String summaryTable = newDataName + "unified_search_summary_0307";
        String pmArticleTable = newDataName + "spider_pubmed_vip_extend";
        String ncTextTable = "html.nc_text_table";

        //        String limit = "";
        String limit = " limit 100";

        updateWebSite(summaryTable, doiTable, doiAddTable, pmArticleTable, ncTextTable, limit);


// main
    }


    public static void updateWebSite(String summaryTable, String doiTable, String doiAddTable, String pmArticleTable, String ncTextTable, String limit) throws SQLException {
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Map<String, String> doiAndLocationMap = new ConcurrentHashMap<>();
        Map<Integer, byte[]> aidAndTiAuJ9Map = new ConcurrentHashMap<>();

        WebSite.getDoiAndLocationMap(doiTable, "id", "doi`,`location", doiAndLocationMap, limit);
        WebSite.getDoiAndLocationMap(doiAddTable, "id", "doi`,`location", doiAndLocationMap, limit);
        System.out.println("\033[31;1m" + format.format(new Date()) + " ⒃ 读取doi的下一跳结束，doiAndLocationMap.size()：" + doiAndLocationMap.size() + Utils.printMemoryStr() + "\033[0m");

        Map<Integer, byte[]> pmIdAndAdListMap = getPmIdAndAdListMap(pmArticleTable, "id", "pmid`,`author_extend", limit);
        System.out.println("\033[31;1m" + format.format(new Date()) + " ⒄ 读取pm的ad信息结束，pmIdAndAdListMap.size()：" + pmIdAndAdListMap.size() + Utils.printMemoryStr() + "\033[0m");

        Map<Integer, String> aidAndReferencesMap = getAidAndReferencesMap(summaryTable, "id", "aid`,`year`,`auth`,`journal`,`title`,`cn_ti`,`info`,`pmId", limit, aidAndTiAuJ9Map);
        System.out.println("\033[31;1m" + format.format(new Date()) + " ⒅ 读取参文信息结束，aidAndReferencesMap.size()：" + aidAndReferencesMap.size() + " aidAndTiAuJ9Map.size()：" + aidAndTiAuJ9Map.size() + Utils.printMemoryStr() + "\033[0m");

        Set<Integer> bookChapterSet = getBookChapterSet(ncTextTable, "id", "pmid`,`ptList", limit);
        System.out.println("\033[31;1m" + format.format(new Date()) + " ⒅ 读取Book Chapter结束，bookChapterSet.size()：" + bookChapterSet.size() + Utils.printMemoryStr() + "\033[0m");

        // 这里更新了七种：预警期刊、参考文献、被引次数、发文国家集合、是否中国人发文、全文网址域名、pm和ad集合。
        updateReferences(summaryTable, "id", "references`,`citations`,`c1_au`,`year`,`journal`,`ncbi_journal`,`nlmId`,`pmId`,`doi`,`pt", aidAndReferencesMap, limit, pmIdAndAdListMap, doiAndLocationMap, aidAndTiAuJ9Map, bookChapterSet);

        System.out.println("\033[31;1m" + format.format(new Date()) + " ⒆ 更新参文等七项数据结束" + Utils.printMemoryStr() + "\033[0m");
        doiAndLocationMap.clear();
        aidAndTiAuJ9Map.clear();
        pmIdAndAdListMap.clear();
        aidAndReferencesMap.clear();

    }

    public static void updateReferences(String summaryTable, String autoId, String field, Map<Integer, String> aidAndReferencesMap, String limit, Map<Integer, byte[]> pmIdAndAdListMap, Map<String, String> doiAndLocationMap,
                                        Map<Integer, byte[]> aidAndTiAuJ9Map, Set<Integer> bookChapterSet) throws SQLException {
        Db use = Db.use();
        int onePageNum = 1000;
        List<Entity> tableNum = use.query("select count(1) as count from " + summaryTable);
        Set<String> early2020 = getEarly2020();
        Set<String> early2021 = getEarly2021();
        Set<String> early2023 = getEarly2023();
        Set<String> early2024 = getEarly2024();
        if (tableNum.get(0).getInt("count") < 1) {
            return;
        }
        int tableMax = use.queryNumber("select max(" + autoId + ") from " + summaryTable).intValue();
        Collection<Integer> tableList = new ArrayList<>();
        NumberUtil.appendRange(0, tableMax + onePageNum, onePageNum, tableList);
        tableList.parallelStream().forEach(startId -> {
            try {
                List<Entity> tableData = use.query("select `" + autoId + "`,`" + field + "` from " + summaryTable + " where " + autoId + " between " + startId + " and " + (startId + onePageNum - 1) + limit);
                for (Entity entry : tableData) {
                    Integer id = entry.getInt(autoId);
                    if (null != id && id > 0) {
                        List<Integer> referencesList = strToList(entry.getStr("references"));
                        List<String> reList = new ArrayList<>();
                        for (Integer aid : referencesList) {
                            if (aidAndReferencesMap.containsKey(aid)) {
                                reList.add(aidAndReferencesMap.get(aid));
                            }
                        }
                        List<Integer> citationsList = strToList(entry.getStr("citations"));
                        List<En.TiAuJ9> tiAuJ9List = new ArrayList<>();
                        for (Integer aid : citationsList) {
                            if (aidAndTiAuJ9Map.containsKey(aid)) {
                                String str = ZipUtil.unGzip(aidAndTiAuJ9Map.get(aid), "utf-8");
                                En.TiAuJ9 tiAuJ9 = JSONObject.parseObject(str, En.TiAuJ9.class);
                                tiAuJ9List.add(tiAuJ9);
                            }
                        }
                        String c1Au = Utils.getStrField(entry, "c1_au");
                        List<En.C1Auth> c1List = c1Au.contains("sort") ? JSONObject.parseArray(c1Au, En.C1Auth.class) : new ArrayList<>();
                        List<String> countryList = new ArrayList<>();
                        for (En.C1Auth c1Auth : c1List) {
                            String country = c1Auth.getCountry();
                            if (country.length() > 1) {
                                countryList.add(country);
                            }
                        }
                        int year = Utils.getIntField(entry, "year");
                        int pmId = Utils.getIntField(entry, "pmId");
                        String ads = pmIdAndAdListMap.containsKey(pmId) ? ZipUtil.unGzip(pmIdAndAdListMap.get(pmId), "utf-8") : "";

                        List<String> ptList = Utils.getFieldList(entry, "pt");
                        if (bookChapterSet.contains(pmId) && !ptList.contains("Book Chapter")) {
                            ptList.add("Book Chapter");
                        }

                        String journal = Utils.getStrField(entry, "journal").toUpperCase();
                        String ncbiJournal = Utils.getStrField(entry, "ncbi_journal").toUpperCase();
                        String nlmId = Utils.getStrField(entry, "nlmId").toUpperCase();
                        int isEarly = 0;
                        if (year == 2020 && (early2020.contains(journal) || early2020.contains(ncbiJournal) || early2020.contains(nlmId))) {
                            isEarly = 1;
                        } else if (year == 2021 && (early2021.contains(journal) || early2021.contains(ncbiJournal) || early2021.contains(nlmId))) {
                            isEarly = 1;
                        } else if (year == 2023 && (early2023.contains(journal) || early2023.contains(ncbiJournal) || early2023.contains(nlmId))) {
                            isEarly = 1;
                        } else if (year == 2024 && (early2024.contains(journal) || early2024.contains(ncbiJournal) || early2024.contains(nlmId))) {
                            isEarly = 1;
                        }
                        String di = Utils.getStrField(entry, "doi");
                        String webSite = "";
                        if (doiAndLocationMap.containsKey(di)) {
                            webSite = doiAndLocationMap.get(di).toLowerCase().replaceAll("(?i)https:///", "").replaceAll("(?i)https://", "").replaceAll("(?i)http:///", "")
                                    .replaceAll("(?i)http://", "").replaceAll("(?i)www3.", "").replaceAll("(?i)www2.", "").replaceAll("(?i)www1.", "")
                                    .replaceAll("(?i)www.", "").replace("?", "/").replace("=", "/").replace(":", "/");
                            webSite = (webSite.indexOf("/") > 0) ? webSite.substring(0, webSite.indexOf("/")) : webSite;
                        }
                        try {
                            Db.use().update(Entity.create().set("early_warning", isEarly).set("is_china", countryList.contains("中国") ? 1 : 0).set("cn_country", JSONUtil.toJsonStr(countryList))
                                    .set("web_site", webSite).set("citations", JSONUtil.toJsonStr(tiAuJ9List)).set("pt", JSONUtil.toJsonStr(ptList))
                                    .set("times_cited", citationsList.size()).set("pm_ad", ads).set("references", CollUtil.join(reList, "; ")), Entity.create(summaryTable).set(autoId, id));
                        } catch (SQLException e) {
                            e.printStackTrace();
                        }
                    }
                }
            } catch (SQLException e) {
                e.printStackTrace();
            }
        });
    }

    public static List<Integer> strToList(String str) {
        List<Integer> list = new ArrayList<>();
        if (null != str && !str.isEmpty()) {
            String[] split = str.split(",");
            for (String s : split) {
                if (NumberUtil.isInteger(s.trim())) {
                    int aid = Integer.parseInt(s.trim());
                    if (aid > 0) {
                        list.add(aid);
                    }
                }
            }
        }
        return list;
    }

    public static Map<Integer, String> getAidAndReferencesMap(String summaryTable, String autoId, String field, String limit, Map<Integer, byte[]> aidAndTiAuJ9Map) throws SQLException {
        Db use = Db.use();
        int onePageNum = 1000;
        List<Entity> tableNum = use.query("select count(1) as count from " + summaryTable);
        Map<Integer, String> aidAndReferencesMap = new ConcurrentHashMap<>();
        if (tableNum.get(0).getInt("count") > 0) {
            int tableMax = use.queryNumber("select max(" + autoId + ") from " + summaryTable).intValue();
            Collection<Integer> tableList = new ArrayList<>();
            NumberUtil.appendRange(0, tableMax + onePageNum, onePageNum, tableList);
            tableList.parallelStream().forEach(startId -> {
                try {
                    List<Entity> tableData = use.query("select `" + autoId + "`,`" + field + "` from " + summaryTable + " where " + autoId + " between " + startId + " and " + (startId + onePageNum - 1) + limit);
                    for (Entity entry : tableData) {
                        Integer aid = entry.getInt("aid");
                        if (null != aid && aid > 0) {
                            int year = Utils.getIntField(entry, "year");
                            List<String> authList = Utils.getFieldList(entry, "auth");
                            String journal = Utils.getStrField(entry, "journal");
                            String auth = !authList.isEmpty() ? authList.get(0) : "[Anonymous]";
                            String info = auth + ", " + year + ", " + journal + ", doi 10.1086/" + aid;
                            String title = Utils.getStrField(entry, "title");
                            String cnTitle = Utils.getStrField(entry, "cn_ti");
                            En.TiAuJ9 tiAuJ9 = new En.TiAuJ9();
                            tiAuJ9.setTi(title.isEmpty() ? cnTitle : title);
                            tiAuJ9.setAu(CollUtil.join((authList.size() > 5 ? authList.subList(0, 5) : authList), "; "));
                            tiAuJ9.setSo(Utils.getStrField(entry, "info"));
                            tiAuJ9.setPmId(Utils.getIntField(entry, "pmId"));
                            tiAuJ9.setAId(aid);
                            byte[] zip = ZipUtil.gzip(JSONUtil.toJsonStr(tiAuJ9), "utf-8");
                            aidAndTiAuJ9Map.put(aid, zip);
                            aidAndReferencesMap.put(aid, info.replace(", , ", ", ").replace("; ", ", ").trim());
                        }
                    }
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            });
        }
        return aidAndReferencesMap;
    }

    public static Set<Integer> getBookChapterSet(String ncTextTable, String autoId, String field, String limit) throws SQLException {
        Db use = Db.use();
        int onePageNum = 1000;
        List<Entity> tableNum = use.query("select count(1) as count from " + ncTextTable);
        Set<Integer> bookChapterSet = new ConcurrentHashSet<>();
        if (tableNum.get(0).getInt("count") > 0) {
            int tableMax = use.queryNumber("select max(" + autoId + ") from " + ncTextTable).intValue();
            Collection<Integer> tableList = new ArrayList<>();
            NumberUtil.appendRange(0, tableMax + onePageNum, onePageNum, tableList);
            tableList.parallelStream().forEach(startId -> {
                try {
                    List<Entity> tableData = use.query("select `" + autoId + "`,`" + field + "` from " + ncTextTable + " where " + autoId + " between " + startId + " and " + (startId + onePageNum - 1) + limit);
                    for (Entity entry : tableData) {
                        Integer pmId = entry.getInt("pmid");
                        String pts = entry.getStr("ptList");
                        if (null != pmId && pmId > 0 && null != pts && pts.toLowerCase().contains("book chapter")) {
                            bookChapterSet.add(pmId);
                        }
                    }
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            });
        }
        return bookChapterSet;
    }

//    public static void updateDoiAndLocation(String summaryTable, String autoId, String field, Map<String, String> doiAndLocationMap, String limit) throws SQLException {
//        Db use = Db.use();
//        int onePageNum = 1000;
//        List<Entity> tableNum = use.query("select count(1) as count from " + summaryTable);
//        if (tableNum.get(0).getInt("count") > 0) {
//            int tableMax = use.queryNumber("select max(" + autoId + ") from " + summaryTable).intValue();
//            Collection<Integer> tableList = new ArrayList<>();
//            NumberUtil.appendRange(0, tableMax + onePageNum, onePageNum, tableList);
//            tableList.parallelStream().forEach(startId -> {
//                try {
//                    List<Entity> tableData = use.query("select `" + autoId + "`,`" + field + "` from " + summaryTable + " where " + autoId + " between " + startId + " and " + (startId + onePageNum - 1) + limit);
//                    for (Entity entry : tableData) {
//                        Integer id = entry.getInt(autoId);
//                        String di = Utils.getStrField(entry, "doi");
//                        if (null != id && id > 0 && doiAndLocationMap.containsKey(di)) {
//                            String webSite = doiAndLocationMap.get(di).toLowerCase().replaceAll("(?i)https:///", "").replaceAll("(?i)https://", "").replaceAll("(?i)http:///", "")
//                                    .replaceAll("(?i)http://", "").replaceAll("(?i)www3.", "").replaceAll("(?i)www2.", "").replaceAll("(?i)www1.", "")
//                                    .replaceAll("(?i)www.", "").replace("?", "/").replace("=", "/").replace(":", "/");
//                            webSite = (webSite.indexOf("/") > 0) ? webSite.substring(0, webSite.indexOf("/")) : webSite;
//                            try {
//                                Db.use().update(Entity.create().set("web_site", webSite), Entity.create(summaryTable).set(autoId, id));
//                            } catch (SQLException e) {
//                                e.printStackTrace();
//                            }
//                        }
//                    }
//                } catch (SQLException e) {
//                    e.printStackTrace();
//                }
//            });
//        }
//    }

    public static void getDoiAndLocationMap(String doiTable, String autoId, String field, Map<String, String> doiAndLocationMap, String limit) throws SQLException {
        Db use = Db.use();
        int onePageNum = 1000;
        List<Entity> tableNum = use.query("select count(1) as count from " + doiTable);
        if (tableNum.get(0).getInt("count") > 0) {
            int tableMax = use.queryNumber("select max(" + autoId + ") from " + doiTable).intValue();
            Collection<Integer> tableList = new ArrayList<>();
            NumberUtil.appendRange(0, tableMax + onePageNum, onePageNum, tableList);
            tableList.parallelStream().forEach(startId -> {
                try {
                    List<Entity> tableData = use.query("select `" + autoId + "`,`" + field + "` from " + doiTable + " where " + autoId + " between " + startId + " and " + (startId + onePageNum - 1) + limit);
                    for (Entity entry : tableData) {
                        String doi = entry.getStr("doi");
                        String location = entry.getStr("location");
                        if (null != doi && null != location && doi.contains("10.") && (location.toLowerCase().contains("http") || location.toLowerCase().contains("www"))) {
                            doiAndLocationMap.put(doi.toLowerCase().trim(), location);
                        }
                    }
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            });
        }
    }

    public static Map<Integer, byte[]> getPmIdAndAdListMap(String pmArticleTable, String autoId, String field, String limit) throws SQLException {
        List<Entity> tableNum = Db.use().query("select count(1) as count from " + pmArticleTable);
        int onePageNum = 1000;
        Map<Integer, byte[]> pmIdAndAdListMap = new ConcurrentHashMap<>();
        if (tableNum.get(0).getInt("count") > 0) {
            int tableMax = Db.use().queryNumber("select max(" + autoId + ") from " + pmArticleTable).intValue();
            Collection<Integer> tableList = new ArrayList<>();
            NumberUtil.appendRange(0, tableMax + onePageNum, onePageNum, tableList);
            tableList.parallelStream().forEach(startId -> {
                try {
                    List<Entity> tableData = Db.use().query("select `" + autoId + "`,`" + field + "` from " + pmArticleTable + " where " + autoId + " between " + startId + " and " + (startId + onePageNum - 1) + limit);
                    for (Entity entry : tableData) {
                        Integer pmId = entry.getInt("pmid");
                        String authorExtend = entry.getStr("author_extend");
                        if (null != pmId && pmId > 0 && null != authorExtend && authorExtend.contains("Affiliation")) {
                            JSONArray objects = JSONUtil.parseArray(authorExtend);
                            List<String> adList = new ArrayList<>();
                            for (Object object : objects) {
                                JSON parse = JSONUtil.parse(object);
                                String affiliation = parse.getByPath("Affiliation").toString();
                                List<String> infoList = com.alibaba.fastjson.JSON.parseArray(affiliation, String.class);
                                for (String s : infoList) {
                                    if (!adList.contains(s) && s.length() > 8) {
                                        adList.add(s);
                                    }
                                }
                            }
                            if (!adList.isEmpty()) {
                                byte[] zip = ZipUtil.gzip(JSONUtil.toJsonStr(adList), "utf-8");
                                pmIdAndAdListMap.put(pmId, zip);
                            }
                        }
                    }
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            });
        }
        return pmIdAndAdListMap;
    }

    public static Set<String> getEarly2024() {
        Set<String> set = new HashSet<>();
        set.add("ENVIRON SCI POLLUT R");
        set.add("EXP THER MED");
        set.add("J CLIN MED");
        set.add("FRONTIERS IN ENERGY RESEARCH");
        set.add("JOURNAL OF PERSONALIZED MEDICINE");
        set.add("J BIOMATER TISSUE ENG");
        set.add("JOURNAL OF NANOELECTRONICS AND OPTOELECTRONICS");
        set.add("MULTIMED TOOLS APPL");
        set.add("PSYCHIATRIA DANUBINA");
        set.add("FUEL");
        set.add("SCIENCE OF ADVANCED MATERIALS");
        set.add("J SENS");
        set.add("MATH BIOSCI ENG");
        set.add("RADIOLOGIA MEDICA");
        set.add("EXPERIMENTAL AND THERAPEUTIC MEDICINE");
        set.add("MATER EXPRESS");
        set.add("CONNECT SCI");
        set.add("MULTIMEDIA TOOLS AND APPLICATIONS");
        set.add("RADIOL MED");
        set.add("DIAGNOSTICS");
        set.add("MATERIALS EXPRESS");
        set.add("J SENSORS");
        set.add("JOURNAL OF BIOMEDICAL NANOTECHNOLOGY");
        set.add("CONNECTION SCIENCE");
        set.add("CANCERS");
        set.add("FRONT ENERGY RES");
        set.add("ALTERNATIVE THERAPIES IN HEALTH AND MEDICINE");
        set.add("J BIOMATER TISS ENG");
        set.add("JOURNAL OF BIOMATERIALS AND TISSUE ENGINEERING");
        set.add("J NANOELECTRON OPTOELECTRON");
        set.add("PSYCHIATR DANUB");
        set.add("J NANOELECTRON OPTOE");
        set.add("CMES COMP MODEL ENG");
        set.add("ALTERN THER HEALTH M");
        set.add("CMES COMPUTER MODELING IN ENGINEERING & SCIENCES");
        set.add("J BIOBASED MATER BIOENERGY");
        set.add("JOURNAL OF CLINICAL MEDICINE");
        set.add("TROPICAL JOURNAL OF PHARMACEUTICAL RESEARCH");
        set.add("J PERS MED");
        set.add("PSYCHIAT DANUB");
        set.add("ENVIRONMENTAL SCIENCE AND POLLUTION RESEARCH");
        set.add("TROP J PHARM RES");
        set.add("ENVIRON SCI POLLUT RES");
        set.add("SCI ADV MATER");
        set.add("J BIOMED NANOTECHNOL");
        set.add("MATHEMATICAL BIOSCIENCES AND ENGINEERING");
        set.add("JOURNAL OF SENSORS");
        set.add("J BIOBASED MATER BIO");
        set.add("JOURNAL OF BIOBASED MATERIALS AND BIOENERGY");
        set.add("ALTERN THER HEALTH MED");
        set.add("CMES COMP MODEL ENG SCI");
        set.add("BIOENGINEERED");
        set.add("101526829");
        set.add("101658402");
        set.add("9441769");
        set.add("101556828");
        set.add("101606588");
        set.add("101602269");
        set.add("0177625");
        set.add("101581063");
        set.add("9012163");
        set.add("101555932");
        set.add("9424753");
        set.add("101291525");
        set.add("101591609");
        set.add("101230869");
        set.add("101703746");
        set.add("101598992");
        set.add("9502013");
        set.add("101511516");
        set.add("101531947");
        set.add("101638683");
        set.add("101197794");
        set.add("101214391");
        return set;
    }

    public static Set<String> getEarly2023() {
        Set<String> set = new HashSet<>();
        set.add("JOURNAL OF ENVIRONMENTAL AND PUBLIC HEALTH");
        set.add("9424753");
        set.add("J CLIN LAB ANAL");
        set.add("WORLD JOURNAL OF CLINICAL CASES");
        set.add("101682385");
        set.add("101591609");
        set.add("JOURNAL OF CLINICAL LABORATORY ANALYSIS");
        set.add("TEXTILE RESEARCH JOURNAL");
        set.add("BUILDINGS BASEL");
        set.add("INT J CONTROL AUTOM");
        set.add("MACHINES");
        set.add("J BIOMATER TISSUE ENG");
        set.add("101512861");
        set.add("PSYCHIATRIA DANUBINA");
        set.add("ACTA MEDICA MEDITERRANEA");
        set.add("J STRUCT CHEM");
        set.add("ECON RES EKON ISTRAZ");
        set.add("FRONT ENVIRON SCI");
        set.add("FRONT EARTH SCI");
        set.add("FRONTIERS IN EARTH SCIENCE");
        set.add("9878794");
        set.add("MICROPROCESS MICROSYST");
        set.add("INT J CONTROL AUTOM SYST");
        set.add("EKON ISTRAZ");
        set.add("ENERGY REPORTS");
        set.add("INTERNATIONAL JOURNAL OF ELECTROCHEMICAL SCIENCE");
        set.add("FRONT SURG");
        set.add("101493030");
        set.add("PHARMAZIE");
        set.add("MATH PROBL ENG");
        set.add("INT J ELECTROCHEM SCI");
        set.add("WORLD J CLIN CASES");
        set.add("COMPUTATIONAL AND MATHEMATICAL METHODS IN MEDICINE");
        set.add("AMERICAN JOURNAL OF TRANSLATIONAL RESEARCH");
        set.add("101735833");
        set.add("JOURNAL OF INDUSTRIAL AND MANAGEMENT OPTIMIZATION");
        set.add("INORGANIC AND NANO METAL CHEMISTRY");
        set.add("AEROSPACE BASEL");
        set.add("INTERNATIONAL JOURNAL OF CONTROL AUTOMATION AND SYSTEMS");
        set.add("MOB INF SYST");
        set.add("BUILDINGS");
        set.add("COMPUT MATH METHOD M");
        set.add("101721978");
        set.add("FOOD SCIENCE AND TECHNOLOGY");
        set.add("FOOD SCI TECHNOL");
        set.add("FRONT EARTH SC SWITZ");
        set.add("MATHEMATICAL PROBLEMS IN ENGINEERING");
        set.add("J BIOMATER TISS ENG");
        set.add("JOURNAL OF BIOMATERIALS AND TISSUE ENGINEERING");
        set.add("TEXT RES J");
        set.add("MICROPROCESS MICROSY");
        set.add("ECONOMIC RESEARCH EKONOMSKA ISTRAZIVANJA");
        set.add("PSYCHIATR DANUB");
        set.add("FRONT ENV SCI SWITZ");
        set.add("J STRUCT CHEM+");
        set.add("MOBILE INFORMATION SYSTEMS");
        set.add("ENERGY REP");
        set.add("GEOFLUIDS");
        set.add("FOOD SCI TECH BRAZIL");
        set.add("101516361");
        set.add("AM J TRANSL RES");
        set.add("MICROPROCESSORS AND MICROSYSTEMS");
        set.add("PSYCHIAT DANUB");
        set.add("101748773");
        set.add("INORG NANO MET CHEM");
        set.add("J ENVIRON PUBLIC HEA");
        set.add("INT J ELECTROCHEM SC");
        set.add("101277751");
        set.add("101618806");
        set.add("J IND MANAG OPTIM");
        set.add("8801384");
        set.add("FRONTIERS IN SURGERY");
        set.add("JOURNAL OF STRUCTURAL CHEMISTRY");
        set.add("100954992");
        set.add("101645127");
        set.add("ACTA MEDICA MEDITERR");
        set.add("J ENVIRON PUBLIC HEALTH");
        set.add("AEROSPACE");
        set.add("FRONTIERS IN ENVIRONMENTAL SCIENCE");
        set.add("9800766");
        set.add("COMPUT MATH METHOD MED");
        set.add("101638676");
        return set;
    }

    public static Set<String> getEarly2021() {
        Set<String> set = new HashSet<>();
        set.add("AIMS MATHEMATICS");
        set.add("FRONT CELL DEV BIOL");
        set.add("101629355");
        set.add("SCI PROGRAMMING NETH");
        set.add("MOL THER NUCL ACIDS");
        set.add("VACCINES");
        set.add("101658402");
        set.add("MICROPROCESS MICROSYST");
        set.add("AGING US");
        set.add("PHARMAZIE");
        set.add("JOURNAL OF CELLULAR AND MOLECULAR MEDICINE");
        set.add("101778895");
        set.add("WORLD J CLIN CASES");
        set.add("J MATH");
        set.add("9891351");
        set.add("ANNALS OF PALLIATIVE MEDICINE");
        set.add("9888589");
        set.add("101586313");
        set.add("101676334");
        set.add("INT J GEN MED");
        set.add("SHOCK AND VIBRATION");
        set.add("AIMS MATH");
        set.add("SHOCK VIB");
        set.add("0346411");
        set.add("101475259");
        set.add("MITOCHONDRIAL DNA PART B RESOURCES");
        set.add("FRONTIERS IN CELL AND DEVELOPMENTAL BIOLOGY");
        set.add("101535920");
        set.add("JOURNAL OF MATHEMATICS");
        set.add("ONCOTARGETS THER");
        set.add("EXPERIMENTAL AND MOLECULAR PATHOLOGY");
        set.add("COMPLEXITY");
        set.add("FRONT MED LAUSANNE");
        set.add("BIOFACTORS");
        set.add("J PERS MED");
        set.add("SCI PROGRAM");
        set.add("9609063");
        set.add("HEALTHCARE");
        set.add("JOURNAL OF INTERNATIONAL MEDICAL RESEARCH");
        set.add("FRONTIERS IN MEDICINE");
        set.add("MOL MED REP");
        set.add("ANN PALLIAT MED");
        set.add("101602269");
        set.add("101585484");
        set.add("101515487");
        set.add("HEALTHCARE BASEL");
        set.add("FRONT MOL BIOSCI");
        set.add("CANCER CELL INT");
        set.add("J MATH UK");
        set.add("CANCER MANAG RES");
        set.add("JOURNAL OF CANCER");
        set.add("WORLD JOURNAL OF CLINICAL CASES");
        set.add("ANN PALLLIAT MED");
        set.add("101512700");
        set.add("MITOCHONDRIAL DNA PART B RESOUR");
        set.add("JOURNAL OF PERSONALIZED MEDICINE");
        set.add("101514322");
        set.add("ADV CIV ENG");
        set.add("INTERNATIONAL JOURNAL OF GENERAL MEDICINE");
        set.add("101691304");
        set.add("BIOLOGY BASEL");
        set.add("9878794");
        set.add("101630250");
        set.add("101508617");
        set.add("CANCER CELL INTERNATIONAL");
        set.add("ONCOTARGETS AND THERAPY");
        set.add("101139795");
        set.add("VACCINES BASEL");
        set.add("0370711");
        set.add("101581621");
        set.add("FRONT MED");
        set.add("EXP MOL PATHOL");
        set.add("DIAGNOSTICS");
        set.add("MOLECULAR THERAPY NUCLEIC ACIDS");
        set.add("CANCER MANAGEMENT AND RESEARCH");
        set.add("101083777");
        set.add("MICROPROCESS MICROSY");
        set.add("MED SCI MONITOR");
        set.add("SCIENTIFIC PROGRAMMING");
        set.add("101648047");
        set.add("MICROPROCESSORS AND MICROSYSTEMS");
        set.add("DISCRETE DYN NAT SOC");
        set.add("MEDICAL SCIENCE MONITOR");
        set.add("ADVANCES IN CIVIL ENGINEERING");
        set.add("8807441");
        set.add("101653173");
        set.add("MOLECULAR MEDICINE REPORTS");
        set.add("101580444");
        set.add("101618806");
        set.add("MITOCHONDRIAL DNA B");
        set.add("FRONTIERS IN MOLECULAR BIOSCIENCES");
        set.add("101666525");
        set.add("BIOMEDICINES");
        set.add("101587988");
        set.add("DISCRETE DYNAMICS IN NATURE AND SOCIETY");
        set.add("9800766");
        set.add("LIFE BASEL");
        set.add("J INT MED RES");
        set.add("J CANCER");
        set.add("J CELL MOL MED");
        return set;
    }

    public static Set<String> getEarly2020() {
        Set<String> set = new HashSet<>();
        set.add("101531947");
        set.add("9717360");
        set.add("EXP THER MED");
        set.add("INT J ENERG RES");
        set.add("ONCOL RES");
        set.add("J CLIN MED");
        set.add("BIOSCI REP");
        set.add("101776982");
        set.add("ARTIF CELL NANOMED B");
        set.add("INTERNATIONAL JOURNAL OF ENVIRONMENTAL RESEARCH AND PUBLIC HEALTH");
        set.add("101599172");
        set.add("CATALYSTS");
        set.add("WATER");
        set.add("0375521");
        set.add("101580302");
        set.add("101555929");
        set.add("ATMOSPHERE");
        set.add("101670234");
        set.add("AMERICAN JOURNAL OF TRANSLATIONAL RESEARCH");
        set.add("101088195");
        set.add("101695672");
        set.add("8205768");
        set.add("ONCOLOGY REPORTS");
        set.add("MATHEMATICAL PROBLEMS IN ENGINEERING");
        set.add("J CELL BIOCHEM");
        set.add("0346411");
        set.add("J BIOMATER TISS ENG");
        set.add("101475259");
        set.add("ONCOLOGY RESEARCH");
        set.add("9422756");
        set.add("8102797");
        set.add("ZEITSCHRIFT FUR KRISTALLOGRAPHIE NEW CRYSTAL STRUCTURES");
        set.add("MINERALS BASEL");
        set.add("INTERNATIONAL JOURNAL OF CLINICAL AND EXPERIMENTAL PATHOLOGY");
        set.add("BRAZILIAN JOURNAL OF MEDICAL AND BIOLOGICAL RESEARCH");
        set.add("COATINGS");
        set.add("BIOFACTORS");
        set.add("101204366");
        set.add("JOURNAL OF INTERNATIONAL MEDICAL RESEARCH");
        set.add("MOL MED REP");
        set.add("101546871");
        set.add("Z KRIST NEW CRYST ST");
        set.add("INTERNATIONAL JOURNAL OF ENERGY RESEARCH");
        set.add("101606588");
        set.add("ACTA MEDICA MEDITERR");
        set.add("INT J ENV RES PUB HE");
        set.add("EUR REV MED PHARMACOL SCI");
        set.add("INT J CLIN EXP PATHO");
        set.add("APPL SCI BASEL");
        set.add("ADV DIFFER EQU NY");
        set.add("CANCER BIOMARK");
        set.add("101664675");
        set.add("101600173");
        set.add("101739125");
        set.add("101514322");
        set.add("ADV CIV ENG");
        set.add("ACTA MEDICA MEDITERRANEA");
        set.add("ELECTRONICS");
        set.add("ADVANCES IN DIFFERENCE EQUATIONS");
        set.add("AMERICAN JOURNAL OF CANCER RESEARCH");
        set.add("POLYMERS BASEL");
        set.add("BRAZ J MED BIOL RES");
        set.add("SUSTAINABILITY BASEL");
        set.add("ONCOTARGETS AND THERAPY");
        set.add("101167924");
        set.add("EXPERIMENTAL AND THERAPEUTIC MEDICINE");
        set.add("101493030");
        set.add("J NANOSCI NANOTECHNO");
        set.add("INT J ELECTROCHEM SCI");
        set.add("101671521");
        set.add("BIOMED RES INT");
        set.add("101594777");
        set.add("MATERIALS");
        set.add("101721978");
        set.add("JOURNAL OF NANOSCIENCE AND NANOTECHNOLOGY");
        set.add("JOURNAL OF CELLULAR BIOCHEMISTRY");
        set.add("JOURNAL OF BIOMATERIALS AND TISSUE ENGINEERING");
        set.add("MATHEMATICS BASEL");
        set.add("8213295");
        set.add("MEDICINE");
        set.add("101471010");
        set.add("AM J TRANSL RES");
        set.add("BIOSCIENCE REPORTS");
        set.add("MEDICAL SCIENCE MONITOR");
        set.add("ADVANCES IN CIVIL ENGINEERING");
        set.add("101653204");
        set.add("CELLS");
        set.add("101579976");
        set.add("JOURNAL OF CELLULAR PHYSIOLOGY");
        set.add("101531236");
        set.add("101697598");
        set.add("J INT MED RES");
        set.add("101748883");
        set.add("WATER SUI");
        set.add("INT J CLIN EXP PATHOL");
        set.add("LIFE SCIENCES");
        set.add("BIOMED RESEARCH INTERNATIONAL");
        set.add("EUROPEAN REVIEW FOR MEDICAL AND PHARMACOLOGICAL SCIENCES");
        set.add("101591609");
        set.add("SENSORS");
        set.add("PLANTS BASEL");
        set.add("ELECTRONICS SWITZ");
        set.add("METALS");
        set.add("ADV DIFFER EQU");
        set.add("101596181");
        set.add("LIFE SCI");
        set.add("ENERGIES");
        set.add("ATMOSPHERE BASEL");
        set.add("APPLIED SCIENCES BASEL");
        set.add("BOUNDARY VALUE PROBLEMS");
        set.add("DESALIN WATER TREAT");
        set.add("ARTIFICIAL CELLS NANOMEDICINE AND BIOTECHNOLOGY");
        set.add("INTERNATIONAL JOURNAL OF ELECTROCHEMICAL SCIENCE");
        set.add("AGING US");
        set.add("J CELL PHYSIOL");
        set.add("101480565");
        set.add("Z KRIST NEW CRYST STRUCT");
        set.add("9888589");
        set.add("DESALINATION AND WATER TREATMENT");
        set.add("8911335");
        set.add("BOUND VALUE PROBL");
        set.add("101630280");
        set.add("JOURNAL OF INEQUALITIES AND APPLICATIONS");
        set.add("ONCOL LETT");
        set.add("METALS BASEL");
        set.add("101238455");
        set.add("ONCOTARGETS THER");
        set.add("EXPERIMENTAL AND MOLECULAR PATHOLOGY");
        set.add("COMPLEXITY");
        set.add("ONCOLOGY LETTERS");
        set.add("9609063");
        set.add("0050222");
        set.add("EUR REV MED PHARMACO");
        set.add("101613952");
        set.add("INT J ELECTROCHEM SC");
        set.add("INTERNATIONAL JOURNAL OF MOLECULAR MEDICINE");
        set.add("AM J CANCER RES");
        set.add("INT J ENVIRON RES PUBLIC HEALTH");
        set.add("INT J MOL MED");
        set.add("POLYMERS");
        set.add("100964009");
        set.add("ARTIF CELL NANOMED BIOTECHNOL");
        set.add("101633495");
        set.add("101256509");
        set.add("101682385");
        set.add("101666579");
        set.add("101562250");
        set.add("BIOMED PHARMACOTHER");
        set.add("MOLECULES");
        set.add("J BIOMATER TISSUE ENG");
        set.add("INT J ENERGY RES");
        set.add("101545357");
        set.add("INTERNATIONAL JOURNAL OF CLINICAL AND EXPERIMENTAL MEDICINE");
        set.add("9208097");
        set.add("INT J CLIN EXP MED");
        set.add("101508617");
        set.add("MINERALS");
        set.add("SUSTAINABILITY");
        set.add("MATH PROBL ENG");
        set.add("2985248R");
        set.add("101639462");
        set.add("0370711");
        set.add("NATURAL PRODUCT RESEARCH");
        set.add("EXP MOL PATHOL");
        set.add("9810955");
        set.add("101766564");
        set.add("8112917");
        set.add("J NANOSCI NANOTECHNOL");
        set.add("MATHEMATICS");
        set.add("MEDICINE (BALTIMORE)");
        set.add("INTERNATIONAL JOURNAL OF IMMUNOPATHOLOGY AND PHARMACOLOGY");
        set.add("MED SCI MONITOR");
        set.add("JOURNAL OF CLINICAL MEDICINE");
        set.add("BRAZILIAN J MED BIOL RES");
        set.add("8807441");
        set.add("MOLECULAR MEDICINE REPORTS");
        set.add("CANCER BIOMARKERS");
        set.add("J INEQUAL APPL");
        set.add("NAT PROD RES");
        set.add("SYMMETRY BASEL");
        set.add("PROCESSES");
        set.add("INT J IMMUNOPATH PH");
        set.add("INT J IMMUNOPATHOL PHARMACOL");
        set.add("SENSORS BASEL");
        set.add("IEEE ACCESS");
        set.add("AGRONOMY BASEL");
        set.add("BIOMEDICINE & PHARMACOTHERAPY");
        set.add("ONCOL REP");
        set.add("101549944");
        set.add("101769288");
        set.add("BIOSCIENCE REP");
        set.add("CELLS BASEL");
        return set;
    }


}
